<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <!-- 
        计算属性
        形式：方法,实际存储的是方法的返回值
        仅在创建VUE对象或修改了关联属性时调用1次,后续调用都是直接从内存中取值
     -->
    <div id="app">
        <p>{{msg}}</p>
        <p>{{ msgAttr}}</p>
        <p>{{ msgMd()}}</p>
    </div>
    <script>
        let vm = new Vue({
            el:"#app",
            data:{
               msg:"足球,篮球"

            },
            computed:{
          msgAttr:function(){
              this.msg.replace(",","、");
          }
            },
            methods:{
                msgMd:function () {
                    return this.msg.replace(",","、");
                }
            }
        })
    </script>
</body>
</html>